package dk.pun.aot.shared.character;

import java.io.Serializable;

@SuppressWarnings("serial")
public class MovementRates implements Serializable {

	private static final int[][] rates = {
		{0,0,0,1,1,2,2},
		{1,1,1,1,2,3,6},
		{1,2,2,2,3,6,10},
		{2,2,3,3,4,8,14},
		{2,2,4,4,6,10,16},
		{2,3,4,4,6,12,18},
		{3,3,4,4,8,16,22},
		{4,4,6,6,10,20,26},
		{4,6,6,6,12,24,30},
		{6,6,8,8,14,28,34},
		{6,8,10,10,20,32,40},
		{8,10,12,12,24,36,45},
		{12,14,16,16,30,40,50}
	};
	
	private int athleticismScore;
	private int row;
	
	public void setAthleticismScore(int athleticismScore) {
		this.athleticismScore = athleticismScore;
		this.row = this.getRow(athleticismScore);
	}

	public int getAthleticismScore() {
		return athleticismScore;
	}

	public int getSwim() {
		return rates[this.row][0];
	}

	public int getCrawl() {
		return rates[this.row][1];
	}

	public int getMonkeyRun() {
		return rates[this.row][2];
	}

	public int getWalk() {
		return rates[this.row][3];
	}

	public int getRun() {
		return rates[this.row][4];
	}

	public int getSprint() {
		return rates[this.row][5];
	}

	public int getFly() {
		return rates[this.row][6];
	}

	private int getRow(int athleticismScore) {
		int row = -1;
		switch(athleticismScore) {
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			row = 0; break;
		case 6:
		case 7:
		case 8:
		case 9:
		case 10:
			row = 1; break;
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
			row = 2; break;
		case 16:
		case 17:
		case 18:
		case 19:
		case 20:
			row = 3; break;
		case 21:
		case 22:
		case 23:
		case 24:
		case 25:
		case 26:
		case 27:
		case 28:
		case 29:
		case 30:
			row = 4; break;
		case 31:
		case 32:
		case 33:
		case 34:
		case 35:
		case 36:
		case 37:
		case 38:
		case 39:
		case 40:
			row = 5; break;
		case 41:
		case 42:
		case 43:
		case 44:
		case 45:
		case 46:
		case 47:
		case 48:
		case 49:
		case 50:
			row = 6; break;
		case 51:
		case 52:
		case 53:
		case 54:
		case 55:
		case 56:
		case 57:
		case 58:
		case 59:
		case 60:
			row = 7; break;
		case 61:
		case 62:
		case 63:
		case 64:
		case 65:
		case 66:
		case 67:
		case 68:
		case 69:
		case 70:
			row = 8; break;
		case 71:
		case 72:
		case 73:
		case 74:
		case 75:
		case 76:
		case 77:
		case 78:
		case 79:
		case 80:
			row = 9; break;
		case 81:
		case 82:
		case 83:
		case 84:
		case 85:
		case 86:
		case 87:
		case 88:
		case 89:
		case 90:
			row = 10; break;
		case 91:
		case 92:
		case 93:
		case 94:
		case 95:
		case 96:
		case 97:
		case 98:
		case 99:
			row = 11; break;
		case 100:
			row = 12; break;
		}
		return row;
	}
}
